package main

// #cgo LDFLAGS: -lstatgrab
// #include <statgrab.h>
import "fmt"
import "C"
import (
	"github.com/ddliu/go-httpclient"
	"io/ioutil"
)

func DownFile(url string)  error{

	res, err := httpclient.Get(url, nil)
	if err != nil {
		fmt.Println("error:")
		fmt.Println(err)
		return
	}
	//fmt.Println(res.ToString())
	data, err := res.ReadAll()
	err := ioutil.WriteFile("E:\\coding\\golang_path\\src\\demo\\test.down", data, 0666)
	defer res.Body.Close()
}

func main() {
	stats := C.sg_get_host_info(nil)
	fmt.Println(stats)

	//DownFile("http://www.baidu.com")
	//DownFile("https://codeload.github.com/IISmichinaboy/java-sample/zip/master")
	//fmt.Println("hello world!")
}
